# Contributor: Orson Teodoro <orsonteodoro@hotmail.com>
# Maintainer: Orson Teodoro <orsonteodoro@hotmail.com>

pkgname=font-fantasque-sans
_pkgname=fantasque-sans
pkgver=1.8.0
pkgrel=0
pkgdesc="A font family with a great monospaced variant for programmers."
url="https://github.com/belluzj/fantasque-sans"
arch="noarch"
license="OFL-1.1"
depends="fontconfig"
source="$_pkgname-$pkgver-normal.tar.gz::https://github.com/belluzj/fantasque-sans/releases/download/v$pkgver/FantasqueSansMono-Normal.tar.gz
	$_pkgname-$pkgver-noloopk.tar.gz::https://github.com/belluzj/fantasque-sans/releases/download/v$pkgver/FantasqueSansMono-NoLoopK.tar.gz
	$_pkgname-$pkgver-largelineheight.tar.gz::https://github.com/belluzj/fantasque-sans/releases/download/v$pkgver/FantasqueSansMono-LargeLineHeight.tar.gz
	$_pkgname-$pkgver-largelineheightnoloopk.tar.gz::https://github.com/belluzj/fantasque-sans/releases/download/v$pkgver/FantasqueSansMono-LargeLineHeight-NoLoopK.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"
subpackages="$pkgname-doc $pkgname-normal $pkgname-noloopk \
	$pkgname-largelineheight $pkgname-largelineheightnoloopk"
options="!check" # data files only no tests are distributed

unpack() {
	default_unpack
	mkdir -p "$builddir"
	cd "$builddir"
	mkdir normal noloopk largelineheight largelineheightnoloopk
	tar -xvf "$srcdir"/$_pkgname-$pkgver-normal.tar.gz -C normal
	tar -xvf "$srcdir"/$_pkgname-$pkgver-noloopk.tar.gz -C noloopk
	tar -xvf "$srcdir"/$_pkgname-$pkgver-largelineheight.tar.gz \
		-C largelineheight
	tar -xvf "$srcdir"/$_pkgname-$pkgver-largelineheightnoloopk.tar.gz \
		-C largelineheightnoloopk
}

_variantgenerator() {
	install -d "$subpkgdir/usr/share/fonts/$_pkgname"
	pkgdesc="$pkgdesc ($2)"
	install -t "$subpkgdir"/usr/share/fonts/$_pkgname \
		"$builddir"/$1/OTF/*.otf
}

package() {
	cd "$builddir"/normal
	install -d "$pkgdir/usr/share/fonts/$_pkgname" \
		"$pkgdir"/usr/share/doc/$_pkgname/
	install -t "$pkgdir"/usr/share/doc/$_pkgname/ CHANGELOG.md README.md
}

normal() {
	#they use the same name for the variants
	depends="$depends !$pkgname-noloopk !$pkgname-largelineheight \
		!$pkgname-largelineheightnoloopk"
	_variantgenerator "normal" "Normal"
}

noloopk() {
	depends="$depends !$pkgname-normal !$pkgname-largelineheight \
		!$pkgname-largelineheightnoloopk"
	_variantgenerator "noloopk" "NoLoopK"
}

largelineheight() {
	depends="$depends !$pkgname-normal !$pkgname-noloopk \
		!$pkgname-largelineheightnoloopk"
	_variantgenerator "largelineheight" "LargeLineHeight"
}

largelineheightnoloopk() {
	depends="$depends !$pkgname-normal !$pkgname-noloopk \
		!$pkgname-largelineheight"
	_variantgenerator "largelineheightnoloopk" "LargeLineHeight-NoLoopK"
}

sha512sums="3afbd441d192769ea44fd7730e728844d13c15b0dd52e3968e6e1659ffa11a173d21891c09ceb7465b83a0b8c923129df2554e159620c9611ee9bb6ff35c90c6  fantasque-sans-1.8.0-normal.tar.gz
4f11e03f55dc0cf0fde6ad1774b7e8426abcb15410d8ff2a1a1d0de0a2a52c8cd9015653ec1ec8efb55297ea9ffad59db453a57f8416e1aab2ec2a93777ab34f  fantasque-sans-1.8.0-noloopk.tar.gz
e9a0d22893923d86036e76ce91c614ae0af6c040d2c7b0e37748bd9ae89157377c42a989bf550dc7a7ff1cb987a60691ebc7dd506e6467ddb131061d01f13a71  fantasque-sans-1.8.0-largelineheight.tar.gz
ceda26e13b76f763e18ccd1437692f51f16fea3df9cf7bab356a9770fd012f2a56a0e0bbbe4cae5d76c9126bce5453e3c9d721e1880529d08c9c764abe08140d  fantasque-sans-1.8.0-largelineheightnoloopk.tar.gz"
